package com.juyu.miliao.authentication.dao.mysql;

import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.juyu.miliao.authentication.domain.User;
import com.juyu.miliao.common.dataSource.tool.operate.Operate;
import org.springframework.transaction.annotation.Transactional;

@Repository
public class UserDao {
	@Autowired
	private SqlSession sqlSession;
	
	@Operate("strategy('byUserId', #user.userId)")
	//@Operate(subDs = "miliao-0")
	public int addUser(User user){
		return sqlSession.insert("addUser", user);
	}
	
	@Operate("strategy('byUserId', #id)")
	public User getUserById(long id){
		return sqlSession.selectOne("getUserById", id);
	}

	@Operate("strategy('byUserId', #userId)")
	public void updateUserIsVideo(Long userId) {
		sqlSession.update("updateUserIsVideo",userId);
	}
}
